<extend name="Public/base" />

<block name="body">
    <!-- 标题栏 -->
    <div class="main-title">
        <h2><notempty name = "uname"><span style = "color:red">{$uname.nickname}</span>的资金汇总<else/>资金汇总</notempty></h2>

    </div>
    <div>
      <if condition = "!$_GET[op]">
        <p>用户余额<span style = "color:red"><if condition = "empty($uname['money'])">{$money}<else/>{$uname.money}</if></span>元</p>
      </if>
    </div>
    <div class="cf">
        <!-- 高级搜索 -->
        <div class="search-form fr cf">
            <div class="sleft">
                <input type="text" id="begin_time" name="start_time" class="search-input" value="{$start_time|date='Y-m-d',###}" placeholder="起始时间">
            </div>
            <div style = "float:left;line-height:30px;margin-right:10px;">至</div>
            <div class="sleft">
                <input type="text" id="end_time" name="end_time" class="search-input" value="{$end_time|date='Y-m-d',###}" placeholder="结束时间">
            </div>
            <div class="sleft">
                <a class="sch-btn" href="javascript:;" id="search" url="{:U('index')}"><i class="btn-search"></i></a>
            </div>
        </div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
        <h3>收益亏损</h3>
        <table class="">
            <thead>
            <tr>
				<th>订单类型</th>
				<th>订单金额</th>
				<th>用户盈利</th>
				<th>用户亏损</th>
				<!-- <th>平台手续费</th> -->
				<th>公司收入</th>
				<th>操作</th>
			</tr>
            </thead>
            <tbody>
            <foreach name="profit" item="vo" key = "key">
            <tr class="table-nobg">
              <td>{$vo.title}</td>
    					<td>{$vo.invest}  元</td>
    					<td>{$vo.profit}  元</td>
    					<td>{$vo.loss}  元</td>
    					<!-- <td>{$vo.fee}  元</td> -->
    					<td>{$vo.pal}  元<span>
    					(用户亏损  <span style = "color:red">减</span>  用户盈利 )
    					</span></td>
    					<td>
    						<if condition = "$vo.title eq 恒指订单">
    							<a href = "{:U('FuturesQqlcd/index',array('name'=>$uname['nickname']))}">查看详情</a>
    						<elseif condition = "$vo.title eq 欧元订单"/>
    							<a href = "{:U('FuturesQqlcd/ouyuan',array('name'=>$uname['nickname']))}">查看详情</a>
    						<elseif condition = "$vo.title eq 螺纹钢订单"/>
    							<a href = "{:U('FuturesOrder/index',array('user_name'=>$uname['nickname']))}">查看详情</a>
                <elseif condition = "$vo.title eq 伦敦金订单"/>
                  <a href = "{:U('FuturesGoldOrder/index',array('name'=>$uname['nickname']))}">查看详情</a>
    						<elseif condition = "$vo.title eq 美元订单"/>
                  <a href = "{:U('FuturesDollarOrder/index',array('name'=>$uname['nickname']))}">查看详情</a>
							  <elseif condition = "$vo.title eq 德指订单"/>
                  <a href = "{:U('FuturesDaxOrder/index',array('name'=>$uname['nickname']))}">查看详情</a>
                <elseif condition = "$vo.title eq 比特币订单"/>
                  <a href = "{:U('FuturesBiteOrder/index',array('name'=>$uname['nickname']))}">查看详情</a>
    						</if>

    					</td>
			</tr>
			</foreach>
            </tbody>
        </table>
    </div>
    <div class="data-table table-striped" style = "margin-top:100px">
        <h3>出入金</h3>
        <table class="">
            <thead>
            <tr>
				<th>金额类型</th>
				<th>出入金额</th>
				<th>手续费</th>
				<th>操作</th>
			</tr>
            </thead>
            <tbody>
            <foreach name="gold" item="vo" key = "key">
            <tr class="table-nobg">
        <td>{$vo.title}</td>
				<td>{$vo.money}  元</td>
				<td>{$vo.fee}  元</td>
				<td>
					<if condition = "$vo.title eq 提现">
						<a href = "{:U('FuturesDraw/index?uname='.$uname['nickname'])}">查看详情</a>
					<elseif condition = "$vo.title eq 充值"/>
						<a href = "{:U('FuturesRecharge/index?uname='.$uname['nickname'])}">查看详情</a>
					</if>
				</td>
			</tr>
			</foreach>
            </tbody>
        </table>
    </div>
    <div class="data-table table-striped" style = "margin-top:100px">
        <h3>佣金</h3>
        <table class="">
            <thead>
            <tr>
				<th>佣金状态</th>
				<th>金额</th>
				<th>操作</th>
			</tr>
            </thead>
            <tbody>
            <foreach name="com_data" item="vo" key = "key">
            <tr class="table-nobg">
        <td>{$vo.title}</td>
				<td>{$vo.commission}  元</td>
				<td>
					<if condition = "$vo.title eq 未分配">
						<a href = "{:U('FuturesCommission/index?status=2&Cname='.$uname['nickname'])}">查看详情</a>
					<elseif condition = "$vo.title eq 已分配"/>
						<a href = "{:U('FuturesCommission/index?status=1&Cname='.$uname['nickname'])}">查看详情</a>
					</if>
				</td>
			</tr>
			</foreach>
            </tbody>
        </table>
    </div>
</block>

<block name="script">
    <link href="__STATIC__/datetimepicker/css/datetimepicker.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">
    <php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">';</php>
    <link href="__STATIC__/datetimepicker/css/dropdown.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js?v={:SITE_VERSION}" charset="UTF-8"></script>
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js?v={:SITE_VERSION}"></script>
    <script type="text/javascript">
        $('#begin_time,#end_time,#create_time,#start_time').datetimepicker({
            format: 'yyyy-mm-dd',
            language:"zh-CN",
            minView:2,
            autoclose:true,
        });
        //搜索功能
        $("#search").click(function(){
            var url = $(this).attr('url');
            url = url.substr(0,url.lastIndexOf('.'));
            var query  = $('.search-form').find('input').serialize();
            var status=$('#status').val();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
            query = query.replace(/^&/g,'');
            query+="/status/"+status;
            query = query.replace(/=/gm,"/");
            query = query.replace(/&/gm,"/");
            if( url.indexOf('?')>0 ){
            	if(query.substr(0,1) != "/"){
            		url += "/"+query;
            	}else{
            		url += query;
            	}
            }else{
                url += "/" + query;
            }
            var id = "{:I('get.id')}";
            var op = "{:I('get.op')}";
            url += "/id/" + id + "/op/" + op;
            //alert(url);
            window.location.href = url;
        });
        //回车搜索
        $(".search-input").keyup(function(e){
            if(e.keyCode === 13){
                $("#search").click();
                return false;
            }
        });
        //导航高亮
        $('.side-sub-menu').find('a[href="{:U('FuturesFundSummary/index')}"]').closest('li').addClass('current');
    </script>
</block>
